import os

from kivy.app import App
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.stacklayout import StackLayout


# kv = Builder.load_string('''
# Button:
#     text: "I was created by kv codes"
# ''')

class ImageProcess(BoxLayout):
    baseFolder = r'D:\2021蓝桥\S02-origin'

    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.imageList = os.listdir(self.baseFolder)
        self.imageIndex = 1
        self.ids['myimg'].source = os.path.join(self.baseFolder, self.imageList[0])


    def next(self):
        if self.imageIndex < len(self.imageList):
            self.ids['myimg'].source = os.path.join(self.baseFolder, self.imageList[self.imageIndex])
            self.imageIndex += 1



class ImageProcessApp(App):
    def build(self):
        return ImageProcess()


if __name__ == "__main__":
    ImageProcessApp().run()
